package com.example.demo.day.config.learn.design.factory.x2;

import com.example.demo.day.config.learn.design.factory.x1.SuvCar;

public class SuvCarFactory implements CarFactory<SuvCar> {

    @Override
    public SuvCar create(String color) {
        if (RED.equals(color)) {
            return new SuvCar(color);
        } else if (GREEN.equals(color)) {
            return new SuvCar(color);
        } else if (BLUE.equals(color)) {
            return new SuvCar(color);
        } else {
            throw new RuntimeException("No such color: " + color);
        }
    }
}
